<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form>
        <button id="btn1"></button>
        <button id="btn2"></button>
    </form>


    <script>
        //关联id的几种方法
        document.getElementById('btn1').onclick = function(){
            alert('1');
        }
        $('#btn1').click(function(){
            alert(2);
        })
        $('#btn2').bind('click',function(){
            alert(3);
        })
    </script>
</body>
</html>